import type { NextPage } from 'next'
import type { ReactElement, ReactNode } from 'react'
import styles from './index.module.scss'
import Layout1 from '@/components/layout1'
import { handleRedirect } from '@/utils/auth'
//import { useSession, getSession } from 'next-auth/react'

type NextPageWithLayout = NextPage & {
  getLayout?: (page: ReactElement) => ReactNode
}

const Page: NextPageWithLayout = ({ lang }:any) => {
  //const { data: session, status } = useSession()
  //console.log('status', status, 'session', session);
  return (
    <div className={styles.test01}>
      <div className="line1">test02-11</div>
      <div className="line2">{lang.aa}</div>
    </div>
  )
}

export function getServerSideProps(ctx: GetServerSidePropsContext) {
  return {
    props: {},
    redirect: handleRedirect(ctx),
  }
}

// export async function getStaticProps() {
// 	const res1 = await fetch(`http://localhost:3000/api/queryUserList`)
// 	const res2 = await fetch(`http://localhost:3000/api/queryOrderList`)
// 	const content1 = await res1.json()
// 	const content2 = await res2.json()
// 	return { 
// 		props: {
// 		    dataList1: content1.data || [], 
// 		    dataList2: content2.data || [],
// 		}
// 	}
// }

Page.getLayout = function (page: ReactElement) {
//Page.getLayout = function getLayout(page) {
  return (
    <Layout1>
      {page}
    </Layout1>
  )
}

export default Page
